#ifndef ANALYSISFORM_H
#define ANALYSISFORM_H

#include <QtGui/QWidget>
#include "stat.h"
#include <QGraphicsScene>
namespace Ui {
    class AnalysisForm;
}

class AnalysisForm : public QWidget {
    Q_OBJECT
public:
    AnalysisForm(QWidget *parent = 0);
    ~AnalysisForm();
public slots:
    void setStatementStatistics(qint64 totalNumber,qint64 totalNumberDistinct); // the basic stuff
    void setDurationStatistics(qreal totalTime,qreal averageTime); // the basic stuff
    void toggleStatementSort(bool sortenabled);
    void addStatement(qint64 timesExecuted,qreal totalTime, QString minavgmax,QString statement); // add to statement table
    void clearAll(); // cleans out everything

    void reScaleHistoricPlot();
    void reScaleFrequencyPlot();
    void plotHistoric(Stat* statPtr=NULL);
    void plotFrequency(Stat* statPtr=NULL);
    void doConnections(); // connect some stuff

    /**Sets max/min values.This is done before plotting*/
    void setMaxHistoric(qreal);
    void setMinHistoric(qreal);
    void setMaxFrequency(qreal);
    void setMinFrequency(qreal);

    void setCurrentStat(Stat* ptr){this->m_currentStatPtr= ptr;}
protected:
    void changeEvent(QEvent *e);
protected slots:
    void tabSwitch(int); //we switched to this
signals:
    void SIG_getHistoric(QString);
    void SIG_getFrequency(QString);
    void SIG_updateHistoric();
    void SIG_updateFrequency();
private:
    Ui::AnalysisForm *m_ui;
    Stat* m_currentStatPtr;
    QGraphicsScene* m_historicPlot;
    QGraphicsScene* m_frequencyPlot;
};

#endif // ANALYSISFORM_H
